const AccountModel = require('../model').accountModel;
const DaoTool = require('../lib/daoTool');
exports.queryAccount = function (conn, params) {
    return new Promise(function (resolve, reject) {
        conn.query('select * from account where Account=?', [params.Account], function (err, result) {
            printLog("=queryAccount=", this.sql);
            if (err) reject(err);
            resolve(result)
        });
    });
};
//更新
exports.updateAccount = function (conn, params) {
    return new Promise(function (resolve, reject) {
        conn.query('update account set ? where Account=?;', [DaoTool.generateModelObject(params, AccountModel, 'update'), params.OriginAccount], function (err, result) {
            printLog("=updateAccount=", this.sql);
            if (err) reject(err);
            resolve(result);
        });
    });
};
exports.selectAccount = function (conn, params) {
    return new Promise(function (resolve, reject) {
        conn.query('select Account from account ' + DaoTool.getPageParamsSqlStr(params) + ";", [], function (err, result) {
            printLog("=selectAccount=", this.sql);
            if (err) reject(err);
            resolve(result)
        });
    });
};